<?php
define('INC_PATH', TEMPLATEPATH.'/includes');
define('ADMIN_PATH', TEMPLATEPATH.'/admin');
define('THEME_VERSION', '1.2.4');

if ( is_admin() ) require_once ADMIN_PATH.'/admin.php';
require_once ADMIN_PATH.'/options.php';

require_once INC_PATH.'/template.php';
require_once INC_PATH.'/bg.php';
require_once INC_PATH.'/front.php';
require_once INC_PATH.'/header.php';
require_once INC_PATH.'/layout.php';
require_once INC_PATH.'/navigation.php';
require_once INC_PATH.'/widget.php';

if (!function_exists('wp_pagenavi')){
    require_once INC_PATH.'/wp-pagenavi.php';
}

add_filter('query_vars', 'itx_add_new_var');
function itx_add_new_var($vars) {
    $vars[] = 'itx';
    return $vars;
}

add_action('template_redirect', 'itx_custom_request');
function itx_custom_request(){
    $vars = get_query_var('itx');
    if ($vars == 'css'){
        include_once (TEMPLATEPATH . '/css/style.php');
        exit;
    }elseif ($vars == 'js'){
        include_once (INC_PATH . '/js.php');
        exit;
    }
}

function itx_preview_vars(){
	if (get_query_var('preview'))
	echo '&preview=1&template=calotropis&stylesheet=calotropis';
}
?>